from pyecharts import options as opts
from pyecharts.charts import Bar

l1 = ['星期一', '星期二', '星期三', '星期四', '星期五', '星期七', '星期日']
l2 = [100, 200, 300, 400, 500, 400, 300]
l3 = [300, 400, 500, 400, 300, 200, 100]
bar = (
    Bar()
        .add_xaxis(l1)
        .add_yaxis("l2", l2)
        .add_yaxis("l3", l3)
        .reversal_axis()  # reversal_axis将图形反转
        .set_series_opts(
        label_opts=opts.LabelOpts(position="right"))  # position="right"表示将数值在图形右侧显示，同理left、center分别表示左侧和中间
        .set_global_opts(title_opts=opts.TitleOpts(title="横向柱状图"))
)
bar.render(path='5.横向柱状图.html')
